package com.aiyige.model;

import android.text.TextUtils;

import java.io.Serializable;

/**
 * Created by xiachao on 2017/10/26.
 */

public class Country implements Serializable{

    public String getCountryName() {
        return countryName;
    }

    public void setCountryName(String countryName) {
        this.countryName = countryName;
    }

    public String getPhoneCode() {
        return phoneCode;
    }

    public void setPhoneCode(String phoneCode) {
        this.phoneCode = phoneCode;
    }

    public String getCountryCode() {
        return countryCode;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String countryName;

    public String phoneCode;

    public String countryCode;

    public String index;



    /**
     * 如果有多个首字母，则取第一个，顺序根据json提供的顺序来
     * @return
     */
    public String getIndex() {
        if (TextUtils.isEmpty(countryCode)) {
            index = "";
        } else if (countryCode.length() > 1) {
            index = countryCode.substring(0, 1);
        } else {
            index = countryCode;
        }
        return index;
    }

}
